#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long LL;
LL t;
string s;
const int N=1e6+10;
bool test2(vector<char>& tmp)
{
	int p2=tmp.size();
	for(int i=0;i<p2/2;i++)
	{
		if(tmp[i]!=tmp[p2-i-1])return false;
	}
	return true;
}
bool test()
{
	vector<char> tmp;
	int p1=0;
	int p2=s.size();
	for(int i=0;i<p2;i++)
   {
   	if(s[i]!='l'&&s[i]!='q'&&s[i]!='b')
   	tmp.push_back(s[i]);
	}
	if(!test2(tmp))
	return false;
	while(s[p2-1]=='l'||s[p2-1]=='q'||s[p2-1]=='b')p2--;
	while(s[p1]!='l'||s[p1]!='q'||s[p2]!='b')p1++;
	for(int i=0;i<=p1;i++)
	{
		if(s[p1-i]!=s[p2+i])return false;
	}
	return true;
}
int main()
{  
   cin>>t;
	while(t--)
	{
		string t;
		cin>>t;
		s=t;
		reverse(t.begin(),t.end());
		if(t==s)
		{
		 cout<<"Yes"<<endl;
		 continue;
	   }
		if(test())
		cout<<"Yes"<<endl;
		else 
		cout<<"No"<<endl;
	}
	return 0;
}
